package com.icetech.eom.service.ws;

import com.icetech.commonbase.JsonTools;
import com.icetech.eom.common.annotation.SystemLog;
import com.icetech.eom.domain.response.WebServiceResponse;
import com.icetech.eom.service.Spring;
import com.icetech.eom.service.ws.cust.SpringLoginServer;
import lombok.extern.slf4j.Slf4j;

/**
 * 登录服务接口实现类
 * @author wangzw
 */
@Slf4j
public class LoginServer {

    public String Register(String para) {
        SpringLoginServer springLoginServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springLoginServer = Spring.getBean("springLoginServer");
            String reslut = springLoginServer.register(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String Login(String para) {
        SpringLoginServer springLoginServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springLoginServer = Spring.getBean("springLoginServer");
            String reslut = springLoginServer.login(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    @SystemLog(description = "<web service>修改密码")
    public String ChangePWD(String para) {
        SpringLoginServer springLoginServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springLoginServer = Spring.getBean("springLoginServer");
            String reslut = springLoginServer.changePwd(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String UpdateUs(String para) {
        SpringLoginServer springLoginServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springLoginServer = Spring.getBean("springLoginServer");
            String reslut = springLoginServer.updateUser(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    /**
     * 获取版本信息
     * @return
     */
    @SystemLog(description = "<web service>获取版本")
    public String getVer(){
        SpringLoginServer springLoginServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springLoginServer = Spring.getBean("springLoginServer");
            String reslut = springLoginServer.getVerion();
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }
}
